home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 351-375 / disk_359 / dice / dice.lzh / include / cia.h < prev    next >
C/C++ Source or Header  |  1989-11-08  |  6KB  |  189 lines

  1. #ifndef    HARDWARE_CIA_H
  2. #define    HARDWARE_CIA_H
  3. /*
  4. **    $Header: cia.h,v 36.1 89/06/05 14:43:19 kodiak Exp $
  5. **
  6. **    registers and bits in the Complex Interface Adapter (CIA) chip 
  7. **
  8. **    (C) Copyright 1985,1986,1987,1988 Commodore-Amiga, Inc.
  9. **        All Rights Reserved
  10. */
  11.  
  12. /*
  13.  * ciaa is on an ODD address (e.g. the low byte) -- $bfe001
  14.  * ciab is on an EVEN address (e.g. the high byte) -- $bfd000
  15.  *
  16.  * do this to get the definitions:
  17.  *    extern struct CIA ciaa, ciab;
  18.  */
  19.  
  20.  
  21. struct CIA {
  22.     UBYTE   ciapra;
  23.     UBYTE   pad0[0xff];
  24.     UBYTE   ciaprb;
  25.     UBYTE   pad1[0xff];
  26.     UBYTE   ciaddra;
  27.     UBYTE   pad2[0xff];
  28.     UBYTE   ciaddrb;
  29.     UBYTE   pad3[0xff];
  30.     UBYTE   ciatalo;
  31.     UBYTE   pad4[0xff];
  32.     UBYTE   ciatahi;
  33.     UBYTE   pad5[0xff];
  34.     UBYTE   ciatblo;
  35.     UBYTE   pad6[0xff];
  36.     UBYTE   ciatbhi;
  37.     UBYTE   pad7[0xff];
  38.     UBYTE   ciatodlow;
  39.     UBYTE   pad8[0xff];
  40.     UBYTE   ciatodmid;
  41.     UBYTE   pad9[0xff];
  42.     UBYTE   ciatodhi;
  43.     UBYTE   pad10[0xff];
  44.     UBYTE   unusedreg;
  45.     UBYTE   pad11[0xff];
  46.     UBYTE   ciasdr;
  47.     UBYTE   pad12[0xff];
  48.     UBYTE   ciaicr;
  49.     UBYTE   pad13[0xff];
  50.     UBYTE   ciacra;
  51.     UBYTE   pad14[0xff];
  52.     UBYTE   ciacrb;
  53. };
  54.  
  55.  
  56. /* interrupt control register bit numbers */
  57. #define CIAICRB_TA      0
  58. #define CIAICRB_TB      1
  59. #define CIAICRB_ALRM    2
  60. #define CIAICRB_SP      3
  61. #define CIAICRB_FLG     4
  62. #define CIAICRB_IR      7
  63. #define CIAICRB_SETCLR  7
  64.  
  65. /* control register A bit numbers */
  66. #define CIACRAB_START   0
  67. #define CIACRAB_PBON    1
  68. #define CIACRAB_OUTMODE 2
  69. #define CIACRAB_RUNMODE 3
  70. #define CIACRAB_LOAD    4
  71. #define CIACRAB_INMODE  5
  72. #define CIACRAB_SPMODE  6
  73. #define CIACRAB_TODIN   7
  74.  
  75. /* control register B bit numbers */
  76. #define CIACRBB_START   0
  77. #define CIACRBB_PBON    1
  78. #define CIACRBB_OUTMODE 2
  79. #define CIACRBB_RUNMODE 3
  80. #define CIACRBB_LOAD    4
  81. #define CIACRBB_INMODE0 5
  82. #define CIACRBB_INMODE1 6
  83. #define CIACRBB_ALARM   7
  84.  
  85. /* interrupt control register masks */
  86. #define CIAICRF_TA      (1<<CIAICRB_TA)
  87. #define CIAICRF_TB      (1<<CIAICRB_TB)
  88. #define CIAICRF_ALRM    (1<<CIAICRB_ALRM)
  89. #define CIAICRF_SP      (1<<CIAICRB_SP)
  90. #define CIAICRF_FLG     (1<<CIAICRB_FLG)
  91. #define CIAICRF_IR      (1<<CIAICRB_IR)
  92. #define CIAICRF_SETCLR  (1<<CIAICRB_SETCLR)
  93.  
  94. /* control register A register masks */
  95. #define CIACRAF_START   (1<<CIACRAB_START)
  96. #define CIACRAF_PBON    (1<<CIACRAB_PBON)
  97. #define CIACRAF_OUTMODE (1<<CIACRAB_OUTMODE)
  98. #define CIACRAF_RUNMODE (1<<CIACRAB_RUNMODE)
  99. #define CIACRAF_LOAD    (1<<CIACRAB_LOAD)
  100. #define CIACRAF_INMODE  (1<<CIACRAB_INMODE)
  101. #define CIACRAF_SPMODE  (1<<CIACRAB_SPMODE)
  102. #define CIACRAF_TODIN   (1<<CIACRAB_TODIN)
  103.  
  104. /* control register B register masks */
  105. #define CIACRBF_START   (1<<CIACRBB_START)
  106. #define CIACRBF_PBON    (1<<CIACRBB_PBON)
  107. #define CIACRBF_OUTMODE (1<<CIACRBB_OUTMODE)
  108. #define CIACRBF_RUNMODE (1<<CIACRBB_RUNMODE)
  109. #define CIACRBF_LOAD    (1<<CIACRBB_LOAD)
  110. #define CIACRBF_INMODE0 (1<<CIACRBB_INMODE0)
  111. #define CIACRBF_INMODE1 (1<<CIACRBB_INMODE1)
  112. #define CIACRBF_ALARM   (1<<CIACRBB_ALARM)
  113.  
  114. /* control register B INMODE masks */
  115. #define CIACRBF_IN_PHI2 0
  116. #define CIACRBF_IN_CNT  (CIACRBF_INMODE0)
  117. #define CIACRBF_IN_TA   (CIACRBF_INMODE1)
  118. #define CIACRBF_IN_CNT_TA  (CIACRBF_INMODE0|CIACRBF_INMODE1)
  119.  
  120. /*
  121.  * Port definitions -- what each bit in a cia peripheral register is tied to
  122.  */
  123.  
  124. /* ciaa port A (0xbfe001) */
  125. #define CIAB_GAMEPORT1  (7)   /* gameport 1, pin 6 (fire button*) */
  126. #define CIAB_GAMEPORT0  (6)   /* gameport 0, pin 6 (fire button*) */
  127. #define CIAB_DSKRDY     (5)   /* disk ready* */
  128. #define CIAB_DSKTRACK0  (4)   /* disk on track 00* */
  129. #define CIAB_DSKPROT    (3)   /* disk write protect* */
  130. #define CIAB_DSKCHANGE  (2)   /* disk change* */
  131. #define CIAB_LED        (1)   /* led light control (0==>bright) */
  132. #define CIAB_OVERLAY    (0)   /* memory overlay bit */
  133.  
  134. /* ciaa port B (0xbfe101) -- parallel port */
  135.  
  136. /* ciab port A (0xbfd000) -- serial and printer control */
  137. #define CIAB_COMDTR     (7)   /* serial Data Terminal Ready* */
  138. #define CIAB_COMRTS     (6)   /* serial Request to Send* */
  139. #define CIAB_COMCD      (5)   /* serial Carrier Detect* */
  140. #define CIAB_COMCTS     (4)   /* serial Clear to Send* */
  141. #define CIAB_COMDSR     (3)   /* serial Data Set Ready* */
  142. #define CIAB_PRTRSEL    (2)   /* printer SELECT */
  143. #define CIAB_PRTRPOUT   (1)   /* printer paper out */
  144. #define CIAB_PRTRBUSY   (0)   /* printer busy */
  145.  
  146. /* ciab port B (0xbfd100) -- disk control */
  147. #define CIAB_DSKMOTOR   (7)   /* disk motorr* */
  148. #define CIAB_DSKSEL3    (6)   /* disk select unit 3* */
  149. #define CIAB_DSKSEL2    (5)   /* disk select unit 2* */
  150. #define CIAB_DSKSEL1    (4)   /* disk select unit 1* */
  151. #define CIAB_DSKSEL0    (3)   /* disk select unit 0* */
  152. #define CIAB_DSKSIDE    (2)   /* disk side select* */
  153. #define CIAB_DSKDIREC   (1)   /* disk direction of seek* */
  154. #define CIAB_DSKSTEP    (0)   /* disk step heads* */
  155.  
  156. /* ciaa port A (0xbfe001) */
  157. #define CIAF_GAMEPORT1  (1<<7)
  158. #define CIAF_GAMEPORT0  (1<<6)
  159. #define CIAF_DSKRDY     (1<<5)
  160. #define CIAF_DSKTRACK0  (1<<4)
  161. #define CIAF_DSKPROT    (1<<3)
  162. #define CIAF_DSKCHANGE  (1<<2)
  163. #define CIAF_LED        (1<<1)
  164. #define CIAF_OVERLAY    (1<<0)
  165.  
  166. /* ciaa port B (0xbfe101) -- parallel port */
  167.  
  168. /* ciab port A (0xbfd000) -- serial and printer control */
  169. #define CIAF_COMDTR     (1<<7)
  170. #define CIAF_COMRTS     (1<<6)
  171. #define CIAF_COMCD      (1<<5)
  172. #define CIAF_COMCTS     (1<<4)
  173. #define CIAF_COMDSR     (1<<3)
  174. #define CIAF_PRTRSEL    (1<<2)
  175. #define CIAF_PRTRPOUT   (1<<1)
  176. #define CIAF_PRTRBUSY   (1<<0)
  177.  
  178. /* ciab port B (0xbfd100) -- disk control */
  179. #define CIAF_DSKMOTOR   (1<<7)
  180. #define CIAF_DSKSEL3    (1<<6)
  181. #define CIAF_DSKSEL2    (1<<5)
  182. #define CIAF_DSKSEL1    (1<<4)
  183. #define CIAF_DSKSEL0    (1<<3)
  184. #define CIAF_DSKSIDE    (1<<2)
  185. #define CIAF_DSKDIREC   (1<<1)
  186. #define CIAF_DSKSTEP    (1<<0)
  187.  
  188. #endif    /* HARDWARE_CIA_H */
  189.